<template>
  <div class="result" v-if="props.searchWord">
    <div class="result-title">搜索 '{{ props.searchWord }}'</div>
    <div class="word-list">
      <word-item :wordList="props.wordList" />
    </div>
  </div>
</template>

<script lang="ts" setup>
import WordItem from '@/components/word/WordItem.vue'
import { Word } from '@/model/index'
import { defineProps, PropType } from 'vue'
const props = defineProps({
  searchWord: {
    type: String,
    default: ''
  },
  wordList: {
    type: Array as PropType<Word[]>,
    default: () => {
      return []
    }
  }
})
</script>
<style lang="scss" scoped>
.result {
  max-width: 980px;
  margin: 0 auto;

  .result-title {
    padding-bottom: 9px;
    margin: 40px 0 20px;
    border-bottom: 1px solid #eee;
  }

  .word-list {
    display: flex;
    flex-wrap: wrap;
  }
}
</style>
